package com.lmf.cloud.controller;

import com.lmf.cloud.entity.MyData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Description TODO
 * <p>
 * Copyright @2022 Shanghai Mise Co. Ltd.
 * All right reserved.
 * <p>
 * @Author LiuMingFu
 * @Date 2024/7/18 15:37
 */
@Slf4j
@Tag(name = "测试服务", description = "测试接口crud")
@RequestMapping("/provider")
@RestController
public class MyDataController {

    @Value("${server.port}")
    private int port;

    @Operation(summary = "获取数据", description = "获取数据")
    @RequestMapping("/getData")
    public String getData(@RequestBody MyData myData) {
        System.out.println(myData);
//        int i = 1 / 0; 
        return "当前使用的服务端口=" + port;
    }


    @Operation(summary = "获取数据", description = "获取数据")
    @RequestMapping("/getData2")
    public String getData2(@RequestParam(required = false) String name) {
//        try {
//            Thread.sleep(7000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        log.info("cloud-provider-payment8001服务：name={}", name);
        int i = 1 / 0; 
        return "cloud-provider-payment8001服务：当前使用的服务端口=" + port + "，传入的参数：name=" + name;
    }
}
